package com.heima.comment.controller;

import com.heima.comment.service.CommentService;
import com.heima.model.comment.dtos.ApCommentDto;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1/comment_repay")
public class CommentRepayController {

    @Autowired
    private CommentService commentService;

    /**
     * 回复添加
     * @param dto
     * @return
     */
    @PostMapping("/save")
    public ResponseResult saveCommentRepay(@RequestBody ApCommentDto dto){
        return commentService.saveRepayComment(dto);
    }

    /**
     * 评论回复列表加载
     */
    @PostMapping("/load")
    public ResponseResult loadCommentRepay(@RequestBody ApCommentDto dto){
        return commentService.loadRepayComment(dto);
    }

    /**
     * 点赞回复
     */
    @PostMapping("/like")
    public ResponseResult likeRepayComment(@RequestBody ApCommentDto dto){
        return commentService.likeRepayComment(dto);
    }
}
